package housing.task6_web;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class HelloWorldServlet extends javax.servlet.http.HttpServlet {
    private static final Logger log = Logger.getLogger(HelloWorldServlet.class.getName());

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        BasicConfigurator.configure();
        log.info("init() complete");
    }

    @Override
    public void destroy() {
        super.destroy();
        log.info("destroy() complete");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("<html><body>" + System.currentTimeMillis() + "</body></html>");
    }
}
    

